home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / VIS082S.ARJ / CONFIG.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-17  |  33KB  |  1,290 lines

  1. program config;
  2.  
  3. {$R-,S+,I-,D+,F-,V-,B-,N-,L+ }
  4. {$M 32000,5000,35000 }
  5.  
  6. uses crt,
  7.      scrnunit,scrninpt,general,prompts,
  8.      gentypes,configrt;
  9.  
  10. const normalcolor=112;
  11.       boldcolor=113;
  12.       barcolor=$1f;
  13.       inputcolor=15*5+15;
  14.       choicecolor=117;
  15.       datacolor=118;
  16.  
  17. var prompt:promptset;
  18.     highres:boolean;
  19.  
  20. procedure writeconfig;
  21. var q:file of configsettype;
  22. begin
  23.   assign (q,'Config.BBS');
  24.   rewrite (q);
  25.   write (q,configset);
  26.   close (q);
  27. end;
  28.  
  29. procedure formatconfig;
  30. var cnt:integer;
  31. begin
  32.   configset.versioncod:=thisversioncode;
  33.   configset.longnam:='';
  34.   Configset.Origin1:=Configset.Longnam;
  35.   Configset.Origin2:=Configset.Longnam;
  36.   configset.shortnam:='';
  37.   configset.sysopnam:='';
  38.   getdir (0,configset.forumdi);
  39.   if configset.forumdi[length(configset.forumdi)]<>'\' then configset.forumdi:=configset.forumdi+'\';
  40.   configset.textdi:=configset.forumdi+'text\';
  41.   configset.uploaddi:=configset.forumdi+'files\';
  42.   configset.boarddi:=configset.forumdi+'boards\';
  43.   configset.asciidownloa:='Grabbed from a ViSiON BBS!!!!!';
  44.   configset.textfiledi:=configset.forumdi+'textfile\';
  45.   configset.doordi:=configset.forumdi+'doors\';
  46.   configset.modemsetupst:='ATX6HM0S0=1|';
  47.   configset.modemhangupst:='+++~~~ATH|';
  48.   configset.modemdialprefi:='ATDT';
  49.   configset.modemdialsuffi:='|';
  50.   configset.defbaudrat:=38400;
  51.   configset.useco:=1;
  52.   configset.hashaye:=false;
  53.   configset.anonymousleve:=5;
  54.   configset.numwelcome:=1;
  55.   configset.mintimeou:=5;
  56.   configset.sysopleve:=100;
  57.   configset.defudleve:=0;
  58.   configset.defudpoint:=0;
  59.   configset.normbotcolo:=6;
  60.   configset.normtopcolo:=2;
  61.   configset.outlockcolo:=5;
  62.   configset.splitcolo:=4;
  63.   configset.statlinecolo:=3;
  64.   configset.uploadfacto:=2;
  65.   configset.privat:=false;
  66.   configset.autologi:=true;
  67.   configset.dotcha:='*';
  68.   configset.supportedrate:=[b1200]+[b2400]+[b4800]+[b9600]+[b19200]+[b38400];
  69.   configset.downloadrate:=configset.supportedrate;
  70.   configset.availtim:='10:00 am';
  71.   configset.unavailtim:='10:00 am';
  72.   configset.xmodemopentim:='3:00 am';
  73.   configset.xmodemclosetim:='3:00 am';
  74.   configset.netstart:='3:00 am';
  75.   configset.netend:='3:00 am';
  76.   for cnt:=1 to 100 do configset.usertim[cnt]:=60;
  77.   configset.level2n:=1;
  78.   configset.udlevel2n:=0;
  79.   configset.udpoints2n:=0;
  80.   configset.postleve:=2;
  81.   configset.anonymousst:='Anonymous';
  82.   configset.systempasswor:='SYSTEM1';
  83.   configset.remotedoor:=false;
  84.   configset.allowdoor:=true;
  85.   configset.eventtim[0]:=#0;
  86.   configset.eventbatc[0]:=#0;
  87.   configset.directvideomod:=true;
  88.   configset.checksnowmod:=true;
  89.   configset.matrixtyp:=1;
  90.   configset.syste2:='';
  91.   configset.syste3:='';
  92.   configset.newuserpas:='';
  93.   configset.loginheade:='ViSiON Kicking it live!';
  94.   configset.minpc:=25;
  95.   configset.exemptpc:=50;
  96.   configset.defleve:=25;
  97.   configset.deffil:=25;
  98.   configset.deffp:=5;
  99.   configset.defgfil:=25;
  100.     configset.defgp:=5;
  101.   with configset do begin
  102.   defac:='Validated User';
  103.   staleve:=0;
  104.   stapoint:=0;
  105.   minudrati:=25;
  106.   minud:=30;
  107.   sysop:='SYSOP';
  108.   normenu:=false;
  109.   emchatp:='CHAT';
  110.   whissl:=false;
  111.   edito:='C:\ED.EXE';
  112.   entercha:='You suddenly watch GOD ARISE!';
  113.   exitcha:='Continue using the BBS...';
  114.   bimodemdi:=configset.forumdi+'Bimodem\';
  115.   timepercentbac:=50;
  116.   leechwee:=false;
  117.   chatmatr:=true;
  118.   feedmatr:=true;
  119.   sysopi:='The SysOp is in...';
  120.   sysopo:='Out scrubbing the TOILET!';
  121.   listleve:=35;
  122.   lastleve:=35;
  123.   comd1:='1';
  124.   comd2:='2';
  125.   comd3:='3';
  126.   comd4:='4';
  127.   comd5:='5';
  128.   comd6:='6';
  129.   comd7:='7';
  130.   comd8:='8';
  131.   prom:='[Matrix Login][?/Help]';
  132.   desc1:='Logon System1';
  133.   desc2:='Logon System2';
  134.   desc3:='Logon System3';
  135.   desc4:='Apply as a new user';
  136.   desc5:='Check for access';
  137.   desc6:='Log off';
  138.   desc7:='Feedback to sysops';
  139.   desc8:='Chat with sysops';
  140.   msg2nx:=35;
  141.   leechud:=25;
  142.   leechk:=10;
  143.   answ1:='BUTTHEAD';
  144.   end;
  145.   configset.usetimebank:=true;
  146.   configset.totalallowed:=60;
  147.   configset.levelusetb:=30;
  148.   configset.userume:=true;
  149.   configset.leveltoaddrume:=30;
  150.   configset.startpriv:='10:00 am';
  151.   configset.stoppriv:='10:00 am';
  152.   configset.privlevel:=50;
  153.   configset.minfreesp:=500;
  154.   configset.useonelin:=true;
  155.   configset.netdir:=configset.forumdi+'NET\';
  156.   configset.totform:=1;
  157.   configset.inf[1]:='New User Application';
  158.   configset.inf[2]:='Unused';
  159.   configset.inf[3]:='Unused';
  160.   configset.inf[4]:='Unused';
  161.   configset.inf[5]:='Unused';
  162.   configset.iman[1]:=true;
  163.   configset.iman[2]:=false;
  164.   configset.iman[3]:=false;
  165.   configset.iman[4]:=false;
  166.   configset.iman[5]:=false;
  167.   configset.usezip:=true;
  168.   configset.workdir:=configset.forumdi+'Work\';
  169.   configset.famday:=false;
  170.   configset.netstc:='';
  171.   configset.netenc:='';
  172.   configset.netpas:='ViZNET';
  173.   configset.copre:='';
  174.   configset.cosuf:='';
  175.   configset.dszlog:=configset.forumdi+'Kermie';
  176.   configset.logsize:=10;
  177.   configset.defstacolor:=14;
  178.   configset.definput:=15;
  179.   configset.defpromp:=11;
  180.   configset.defreg:=12;
  181.   configset.defblowin:=13;
  182.   configset.defblowbor:=15;
  183.   configset.autouls:=0;
  184.   configset.pointcomp:=false;
  185.   configset.pathfnme:='';
  186.   configset.usems:=false;
  187.   configset.hangonew:=true;
  188.   Configset.HubBBS:=False;
  189.   Configset.MaximumDosShell:=True;
  190.   Configset.LockOutBaudPass:='Bad Baud Rate';
  191.   ConfigSet.UsePrinterLog:=False;
  192.   ConfigSet.SaveScreen:=True;
  193.   ConfigSet.NumConfs:=1;
  194.   ConfigSet.Conf1:='General Discussion';
  195.   ConfigSet.Conf2:='';
  196.   ConfigSet.Conf3:='';
  197.   ConfigSet.Conf4:='';
  198.   ConfigSet.Conf5:='';
  199.   ConfigSet.NetType1:=True;
  200.   ConfigSet.NetType2:=False;
  201.   ConfigSet.NetType3:=False;
  202.   ConfigSet.NetType1Path:=ConfigSet.ForumDi+'NETUPG\';
  203.   ConfigSet.ShowNewPrompts:=True;
  204.   ConfigSet.NodeNumber:=1;
  205.     configset.multinodebbs:=false;
  206.     configset.gatepass:='DOS SHELL';
  207.     ConfigSet.Sys1PwPromp:='[System 1] Password:';
  208.     ConfigSet.Sys2PwPromp:='[System 2] Password:';
  209.     ConfigSet.Sys3PwPromp:='[System 3] Password:';
  210.     ConfigSet.MatNamePromp:='Enter your Handle or User Number:';
  211.     ConfigSet.MatHangup:='Disconnecting: TTY1';
  212.     ConfigSet.InvalidPromp:='Invalid Choice!';
  213.         configset.UseNUV:=True;
  214.         configset.AutoKillNUV:=True;
  215.         configset.newvotelvl:=50;
  216.         configset.vonum:=5;
  217.         configset.vonumno:=10;
  218.         configset.volvl:=25;
  219.         configset.voflvl:=25;
  220.         configset.vofps:=5;
  221.         configset.kkk1:=1;
  222.         configset.kkk2:=9;
  223.         configset.kkk3:=3;
  224.         configset.kkk4:=13;
  225.         configset.kkk5:=12;
  226.         configset.kkk6:=14;
  227.         configset.kkk7:=4;
  228.         configset.kkk8:=5;
  229.         configset.useansidetect:=TRue;
  230.         configset.usegambling:=True;
  231.         configset.gain:=5;
  232.         configset.chance:=20;
  233.         configset.numpoints:=100;
  234.         configset.numthrows:=4;
  235.         configset.convrate:=10;
  236.         configset.allowtrading:=True;
  237.         configset.allownuking:=True;
  238.     writeconfig
  239. end;
  240.  
  241.  
  242. type ttypetype=(TInteger,Tsstr,Tmstr,Tlstr,TBoolean,TChar,TBaudset,
  243.                 TPath,TTime,TAttrib,Tusertime,Tword,Badtype);
  244.      ptrset=record
  245.        case integer of
  246.          0:(i:^integer);
  247.          1:(l:^lstr);
  248.          2:(b:^boolean);
  249.          3:(k:^char);
  250.          4:(baudsetptr:^baudset)
  251.      end;
  252.      thing=record
  253.        text:mstr;
  254.        descrip:lstr;
  255.        ttype:ttypetype;
  256.        p:pointer;
  257.        r1,r2:integer
  258.      end;
  259.  
  260. const ttypestr:array [ttypetype] of sstr=
  261.   ('Int','sstr','mstr','lstr','Boo','Char','Baud','Path','Time',
  262.    'Attrib','Usertime','Word','!!!!????');
  263.       colorstr:array [0..15] of mstr=
  264.   ('Black  ','Blue ','Green','Cyan ','Red    ','Magenta','Brown   ','White',
  265.    'Gray  ','BLUE!  ','GREEN!','CYAN!  ','RED!     ','MAGENTA!','Yellow   ','WHITE!');
  266.  
  267. const maxthings=200;
  268.       dcol=30;
  269.  
  270. var top,bot,page,numpages,numthings:integer;
  271.     things:array [1..maxthings] of thing;
  272.  
  273. procedure cb;
  274. begin
  275.   setcolor (boldcolor)
  276. end;
  277.  
  278. procedure c4;
  279. begin
  280.   setcolor (boldcolor)
  281. end;
  282.  
  283. procedure cn;
  284. begin
  285.   setcolor (normalcolor)
  286. end;
  287.  
  288. procedure c7;
  289. begin
  290.   setcolor (boldcolor)
  291. end;
  292.  
  293. function match(a1,a2:anystr):boolean;
  294. var cnt:integer;
  295. begin
  296.   match:=false;
  297.   while a1[length(a1)]=' ' do a1[0]:=pred(a1[0]);
  298.   while a2[length(a2)]=' ' do a2[0]:=pred(a2[0]);
  299.   if length(a1)<>length(a2) then exit;
  300.   for cnt:=1 to length(a1) do
  301.     if upcase(a1[cnt])<>upcase(a2[cnt]) then exit;
  302.   match:=true
  303. end;
  304.  
  305. function yesnostr (var b:boolean):sstr;
  306. begin
  307.   if b and (ord(b)<>ord(true)) then b:=true;
  308.   if b then yesnostr:='Yes' else yesnostr:='No'
  309. end;
  310.  
  311. function strr (n:longint):mstr;
  312. var q:mstr;
  313. begin
  314.   str (n,q);
  315.   strr:=q
  316. end;
  317.  
  318. function valu(q:mstr):longint;
  319. var s:integer;
  320.   i:longint;
  321. begin
  322.   val(q,i,s);
  323.   if s=1
  324.     then valu:=0
  325.     else valu:=i
  326. end;
  327.  
  328. function whichpage (n:integer):integer;
  329. begin
  330.   if not highres then whichpage:=((n-1) div 18)+1 else whichpage:=((n-1) div 35)+1
  331. end;
  332.  
  333. function whichline (n:integer):integer;
  334. begin
  335.   if not highres then whichline:=n-18*(whichpage(n)-1)+2 else whichline:=n-35*(whichpage(n)-1)+2;
  336. end;
  337.  
  338. function getbaudstr (var q:baudset):lstr;
  339. var w:lstr;
  340.     cnt:baudratetype;
  341. begin
  342.   w[0]:=chr(0);
  343.   for cnt:=firstbaud to lastbaud do
  344.     if cnt in q then w:=w+strr(baudarray[cnt])+' ';
  345.   if length(w)=0 then w:='None';
  346.   getbaudstr:=w
  347. end;
  348.  
  349. function varstr (n:integer):string;
  350. var pu:pointer;
  351.     p:ptrset absolute pu;
  352. begin
  353.   pu:=things[n].p;
  354.   case things[n].ttype of
  355.     tinteger:varstr:=strr(p.i^);
  356.     tlstr,tmstr,tsstr,tpath,ttime:varstr:=p.l^;
  357.     tboolean:varstr:=yesnostr(p.b^);
  358.     tchar:varstr:=p.k^;
  359.     tbaudset:varstr:=getbaudstr (p.baudsetptr^);
  360.     tattrib:varstr:=colorstr[p.i^];
  361.     tusertime:varstr:='(Use this choice to configure user daily time)';
  362.     tword:varstr:=strr(configset.defbaudrat);
  363.     else varstr:='??!?!?!'
  364.   end
  365. end;
  366.  
  367. procedure writevar (n:integer);
  368. begin
  369.   cb;
  370.   write (varstr(n));
  371.   cn; clreol;
  372.   {writeln}
  373. end;
  374.  
  375. procedure gotopage (p:integer);
  376. var cnt,cy:integer;
  377.     grf:integer;
  378. begin
  379.   if p<1 then p:=1;
  380.   if p>numpages then p:=numpages;
  381.   if p<>page then begin
  382.     if page<>0 then freeprompts (prompt);
  383.     page:=p; setcurwindow(w2);
  384.     gotoxy (1,1);
  385.     cn;    if not highres then
  386.     top:=(page-1)*18+1 else top:=(page-1)*35+1; clreol;write(things[top].descrip);setcurwindow(w1);
  387.     if not highres then bot:=top+17 else bot:=top+34;
  388.     if bot>numthings then bot:=numthings;
  389.     beginprompts (prompt); grf:=17; if highres then grf:=34;
  390.     for cnt:=top to top+grf do begin
  391.       cy:=cnt-top+1;{+3;}
  392.       gotoxy (1,cy);
  393.       cn; clreol;
  394.       if cnt<=bot then begin
  395.         addprompt (prompt,command,prompt,5,cnt-top+1{+3},things[cnt].text+':');
  396.         setinputwid (prompt,0);
  397.         drawprompt (prompt);
  398.         gotoxy (1,cy);
  399.         cn; write (cnt:2,'. ');
  400.         gotoxy (dcol,wherey);
  401.         writevar (cnt)
  402.       end
  403.     end
  404.   end
  405. end;
  406.  
  407. procedure readdata;
  408. var q:text;
  409.     t:mstr;
  410.  
  411.   procedure dataerror (n:lstr);
  412.   begin
  413.     writeln ('Record ',numthings,': '+n);
  414.     halt
  415.   end;
  416.  
  417.   procedure illtype;
  418.   begin
  419.     dataerror ('Invalid type: '+t)
  420.   end;
  421.  
  422.   procedure getrange (t:mstr; var r1,r2:integer);
  423.   var sp,da,n1,n2:integer;
  424.   begin
  425.     sp:=pos(' ',t);
  426.     r1:=-32767;
  427.     r2:=32767;
  428.     if sp=0 then exit;
  429.     t:=copy(t,sp+1,255);
  430.     if length(t)<1 then exit;
  431.     da:=pos('-',t);
  432.     if (da=1) and (length(t)=1) then exit;
  433.     if da=0 then begin
  434.       r1:=valu(t);
  435.       r2:=r1;
  436.       exit
  437.     end;
  438.     n1:=valu(copy(t,1,da-1));
  439.     n2:=valu(copy(t,da+1,255));
  440.     if da=1 then begin
  441.       r2:=n2;
  442.       exit
  443.     end;
  444.     r1:=n1;
  445.     if da=length(t) then exit;
  446.     r2:=n2
  447.   end;
  448.  
  449.   procedure gettype (t:mstr; var tt:ttypetype);
  450.   var sp:integer;
  451.       fw:mstr;
  452.   begin
  453.     tt:=ttypetype(0);
  454.     sp:=pos(' ',t);
  455.     if sp=0
  456.       then fw:=t
  457.       else fw:=copy(t,1,sp-1);
  458.     while tt<>badtype do
  459.       begin
  460.         if match(fw,ttypestr[tt]) then exit;
  461.         tt:=succ(tt)
  462.       end;
  463.     tt:=badtype;
  464.     illtype
  465.   end;
  466.  
  467. begin
  468.   assign (q,'Config.Dat');
  469.   reset (q);
  470.   numthings:=0;
  471.   if ioresult<>0 then dataerror ('File CONFIG.DAT not found!');
  472.   while not eof(q) do begin
  473.     numthings:=numthings+1;
  474.     gotoxy(1,3);write('Reading Item ',numthings,'...');
  475.     with things[numthings] do begin
  476.       readln (q,text);
  477.       readln (q,descrip);
  478.       readln (q,t);
  479.       gettype (t,ttype);
  480.       if ttype=tinteger then getrange (t,r1,r2)
  481.     end
  482.   end;
  483.   close (q);delay(900)
  484. end;
  485.  
  486. procedure assignptrs;
  487. var cnt:integer;
  488.  
  489.   procedure s (var q);
  490.   begin
  491.     cnt:=cnt+1;
  492.     things[cnt].p:=@q;
  493.   end;
  494.  
  495. begin
  496.   cnt:=0;
  497.   with configset do begin
  498.   s (longnam);
  499.   s (shortnam);
  500.   s (sysopnam);
  501.   s (autologi);
  502.   s (forumdi);
  503.   s (textdi);
  504.   s (boarddi);
  505.   s (uploaddi);
  506.   s (textfiledi);
  507.   s (doordi);
  508.   s (netdir);
  509.   s (bimodemdi);
  510.   s (workdir);
  511.   s (supportedrate);
  512.   s (downloadrate);
  513.   s (defbaudrat);
  514.   s (useco);
  515.   s (hashaye);
  516.   s (modemsetupst);
  517.   s (modemhangupst);
  518.   s (modemdialprefi);
  519.   s (modemdialsuffi);
  520.   s (sysopleve);
  521.   s (numwelcome);
  522.   s (privat);
  523.   s (directvideomod);
  524.   s (checksnowmod);
  525.   s (normbotcolo);
  526.   s (normtopcolo);
  527.   s (outlockcolo);
  528.   s (splitcolo);
  529.   s (statlinecolo);
  530.   s (usertim);
  531.   s (mintimeou);
  532.   s (dotcha);
  533.   s (defudleve);
  534.   s (defudpoint);
  535.   s (level2n);
  536.   s (udlevel2n);
  537.   s (udpoints2n);
  538.   s (uploadfacto);
  539.   s (timepercentbac);
  540.   s (availtim);
  541.   s (unavailtim);
  542.   s (xmodemopentim);
  543.   s (xmodemclosetim);  end;
  544.   s (configset.startpriv);
  545.   s (configset.stoppriv);
  546.   s (configset.privlevel);
  547.   s (configset.anonymousst);
  548.   s (configset.iman[1]);
  549.   s (configset.iman[2]);
  550.   s (configset.iman[3]);
  551.   s (configset.iman[4]);
  552.   s (configset.iman[5]);
  553.   s (configset.remotedoor);
  554.   s (configset.allowdoor);
  555.   s (configset.usetimebank);
  556.   s (configset.userume);
  557.   s (configset.useonelin);
  558.   s (configset.usezip);  with configset do begin
  559.   s (normenu);
  560.   s (whissl);
  561.   s (eventtim);
  562.   s (eventbatc);
  563.   s (matrixtyp);
  564.   s (systempasswor);
  565.   s (syste2);
  566.   s (syste3);
  567.   s (newuserpas);
  568.   s (sysop);
  569.   s (emchatp);
  570.   s (loginheade);
  571.   s (minpc);
  572.   s (minudrati);
  573.   s (minud);
  574.   s (exemptpc);
  575.   s (defleve);
  576.   s (deffil);
  577.   s (deffp);
  578.   s (defac);
  579.   s (edito);
  580.   s (entercha);
  581.   s (exitcha);
  582.   s (leechwee);
  583.   s (chatmatr);
  584.   s (feedmatr);
  585.   s (sysopi);
  586.   s (sysopo);
  587.   s (anonymousleve);
  588.   s (postleve);
  589.   s (listleve);
  590.   s (lastleve);
  591.   s (comd1);
  592.   s (comd2);
  593.   s (comd3);
  594.   s (comd4);
  595.   s (comd5);
  596.   s (comd6);
  597.   s (comd7);
  598.   s (comd8);
  599.   s (prom);
  600.   s (desc1);
  601.   s (desc2);
  602.   s (desc3);
  603.   s (desc4);
  604.   s (desc5);
  605.   s (desc6);
  606.   s (desc7);
  607.   s (desc8);
  608.   s (msg2nx);
  609.   s (leechud);
  610.   s (leechk);  end;
  611.   s (configset.totalallowed);
  612.   s (configset.levelusetb);
  613.   s (configset.leveltoaddrume);
  614.   s (configset.minfreesp);
  615.   s (configset.totform);
  616.   s (configset.inf[1]);
  617.   s (configset.inf[2]);
  618.   s (configset.inf[3]);
  619.   s (configset.inf[4]);
  620.   s (configset.inf[5]);
  621.   s (configset.netstart);
  622.   s (configset.netend);
  623.   s (configset.netstc);
  624.   s (configset.netenc);
  625.   s (configset.netpas);
  626.   s (configset.copre);
  627.   s (configset.cosuf);
  628.   s (configset.dszlog);
  629.   s (configset.logsize);
  630.   s (configset.defstacolor);
  631.   s (configset.definput);
  632.   s (configset.defpromp);
  633.   s (configset.defreg);
  634.   s (configset.defblowin);
  635.   s (configset.defblowbor);
  636.   s (configset.autouls);
  637.   s (configset.pointcomp);
  638.   s (configset.pathfnme);
  639.   s (configset.usems);
  640.   s (configset.hangonew);
  641.   s (Configset.Origin1);
  642.   S (Configset.Origin2);
  643.   S (Configset.HubBBS);
  644.   S (Configset.MaximumDosShell);
  645.   S (Configset.LockOutBaudPass);
  646.   S (Configset.UsePrinterLog);
  647.   S (ConfigSet.SaveScreen);
  648.   s (ConfigSet.NumConfs);
  649.   S (ConfigSet.Conf1);
  650.   S (ConfigSet.Conf2);
  651.   S (ConfigSet.Conf3);
  652.   S (ConfigSet.Conf4);
  653.   S (ConfigSet.Conf5);
  654.   s (ConfigSet.NetType1);
  655.   S (ConfigSet.NetType2);
  656.   S (ConfigSet.NetType3);
  657.   S (ConfigSet.NetType1Path);
  658.   S (ConfigSet.ShowNewPrompts);
  659.   s (configset.multinodebbs);
  660.     S (ConfigSet.NodeNumber);
  661.     S (ConfigSet.GatePass);
  662.         s (configset.UseNUV);
  663.         s (configset.AutoKillNUV);
  664.         s (configset.newvotelvl);
  665.         s (configset.vonum);
  666.         s (configset.vonumno);
  667.         s (configset.volvl);
  668.         s (configset.voflvl);
  669.         s (configset.vofps);
  670.         s (configset.kkk1);
  671.         s (configset.kkk2);
  672.         s (configset.kkk3);
  673.         s (configset.kkk4);
  674.         s (configset.kkk5);
  675.         s (configset.kkk6);
  676.         s (configset.kkk7);
  677.         s (configset.kkk8);
  678.         s (configset.useansidetect);
  679.         s (configset.usegambling);
  680.         s (configset.chance);
  681.         s (configset.gain);
  682.         s (configset.numpoints);
  683.         s (configset.numthrows);
  684.         s (configset.convrate);
  685.         s (configset.allowtrading);
  686.         s (configset.allownuking);
  687.   if cnt<>numthings then begin
  688.     writeln ('Error in number of items of CONFIG.DAT');
  689.     writeln ('Expected: ',numthings);
  690.     writeln ('Actual:   ',cnt);
  691.     halt
  692.   end
  693. end;
  694.  
  695. procedure byebye;
  696. begin
  697.   setcurwindow(w2);
  698.   closewindow;
  699.   setcurwindow(w1);closewindow;
  700.   textmode(co80);
  701.   setcolor(15);
  702.   gotoxy(29,22);
  703.   writeln ('ViSiON - What else is there?');
  704.   halt
  705. end;
  706.  
  707. procedure abortyn;
  708. var q:sstr;
  709.     w3:window;
  710.     yesn:boolean;
  711.     k:char;
  712. begin
  713.   yesn:=false;
  714.   openwindow(w3,18,10,50,14,15*4,15*4);
  715.   setcurwindow(w3);
  716.   setcolor(15*4+3);gotoxy(3,1);write('   Abort Configuration');
  717.   repeat
  718.   gotoxy(3,3); setcolor(15*4+3); if yesn then setcolor(barcolor);
  719.   write(' Yes ');setcolor(15*4+3);gotoxy(25,3); if not yesn then setcolor(barcolor);
  720.   write(' No ');
  721.   k:=bioskey;
  722.   if (k=#205) or (K=#131) then yesn:=false;
  723.   if (k=#203) or (k=#130) then yesn:=true;
  724.   if (k='y') or (k='Y') then yesn:=true;
  725.   if (k='n') or (k='N') then yesn:=false;
  726.   until (k=#27) or (k=#13);
  727.   closewindow;setcurwindow(w1);
  728.   if yesn then byebye;
  729. end;
  730.  
  731. procedure getinput (n:integer; editit:boolean);
  732. var y:integer;
  733.     inp:lstr;
  734.     t:thing;
  735.     pu:pointer;
  736.     p:ptrset absolute pu;
  737.  
  738.   procedure reshow;
  739.   begin
  740.     gotoxy (dcol,y-2);
  741.     writevar (n)
  742.   end;
  743.  
  744.   procedure showintrange;
  745.   begin
  746.     c7; setcurwindow(w2); gotoxy(1,2);   clreol;
  747.     with t do
  748.       if r1=-32767
  749.         then if r2=32767
  750.           then write ('No range limitation.')
  751.           else write ('Maximum value: ',r2)
  752.         else if r2=32767
  753.           then write ('Minimum value: ',r1)
  754.           else write ('Valid values range from ',r1,' to ',r2);
  755.     cn; setcurwindow(w1);
  756.   end;
  757.   procedure showbaudrange;
  758.   begin      setcurwindow(w2);
  759.     c7;                  gotoxy(1,2);clreol;
  760.     write('Baud Rates Supported between 300-38400');
  761.     cn  ; setcurwindow(w1);
  762.   end;
  763.  
  764.  
  765.   procedure doint;
  766.   var n,s:integer;
  767.       k:char;
  768.   begin
  769.     val (inp,n,s); setcurwindow(w2);
  770.     gotoxy (1,2);
  771.     if s<>0
  772.       then
  773.         begin
  774.           c4;
  775.           writeln ('Invalid number!  A number must be from -32767 to 32767.');
  776.           cn;
  777.           write ('Press any key...');
  778.           clreol;
  779.           k:=bioskey
  780.         end
  781.       else if (n>=t.r1) and (n<=t.r2)
  782.         then p.i^:=n
  783.         else
  784.           begin
  785.             c4;
  786.             writeln ('Range error!  Must be within the above limits!  ');
  787.             cn;
  788.             write ('Press any key...');
  789.             clreol;
  790.             k:=bioskey
  791.           end; setcurwindow(w1);
  792.   end;
  793.  
  794.   procedure dostr;
  795.   begin
  796.     if (inp='N') or (inp='n') then inp:='';
  797.     p.l^:=inp
  798.   end;
  799.  
  800.   procedure doword;
  801.   var   tpp1,tpp2:word;
  802.         k:char;
  803.    begin
  804.       tpp1:=valu(inp);
  805.       tpp2:=configset.defbaudrat; setcurwindow(w2);
  806.       gotoxy(1,2);  clreol;
  807.       if (tpp1<300) or (tpp1>57600) then begin
  808.          c4;
  809.          writeln('Error - Must be in above ranges');
  810.          cn;
  811.          write('Press any key...');
  812.          clreol;
  813.          setcurwindow(w1);reshow;
  814.          k:=bioskey;
  815.          exit;
  816.       end;   with configset do
  817.       case tpp1 of
  818.            300:defbaudrat:=300;
  819.            1200:defbaudrat:=1200;
  820.            2400:defbaudrat:=2400;
  821.            4800:defbaudrat:=4800;
  822.            9600:defbaudrat:=9600;
  823.            19200:defbaudrat:=19200;
  824.            38400:defbaudrat:=38400;
  825.            57600:defbaudrat:=57600;
  826.            end;
  827.       if (tpp2=configset.defbaudrat) and (tpp1<>configset.defbaudrat) then begin
  828.          c4;
  829.          writeln('Error, valid ranges are 300,1200,2400,4800,9600,19200,38400,57600!');
  830.          cn;
  831.          write('Press any key...');
  832.          clreol;
  833.          k:=bioskey;
  834.       end;  setcurwindow(w1);reshow;
  835.    end;
  836.  
  837.   procedure doboolean;
  838.    var k:char;
  839.   begin
  840.     p.b^:=not p.b^;
  841.     if inp='AA' then k:=readkey;
  842.   end;
  843.  
  844.   procedure dochar;
  845.   begin
  846.     p.k^:=inp[1]
  847.   end;
  848.  
  849.   procedure dopath;
  850.   var lc:char;
  851.       cur:lstr;
  852.       n:integer;
  853.   begin
  854.     if inp='' then inp:=p.l^;
  855.     lc:=inp[length(inp)];
  856.     if (length(inp)<>1) or (upcase(lc)<>'N')
  857.       then if (lc<>':') and (lc<>'\') then inp:=inp+'\';
  858.     dostr;
  859.     inp:=p.l^;
  860.     if inp[length(inp)]='\' then inp[0]:=pred(inp[0]);
  861.     getdir (0,cur);
  862.     chdir (inp);
  863.     n:=ioresult;
  864.     chdir (cur);
  865.     if n=0 then exit;
  866.     c4; setcurwindow(w2);gotoxy (1,2);
  867.     write ('Path doesn''t exist!  ');
  868.     cn; write ('Create it now? '); clreol;
  869.     readln (cur);    setcurwindow(w1);
  870.     if length(cur)=0 then exit;
  871.     if upcase(cur[1])<>'Y' then exit;
  872.     mkdir (inp);
  873.     if ioresult=0 then exit;
  874.     setcurwindow(w2);
  875.     gotoxy (1,2);
  876.     c4; write ('Error creating directory!  ');
  877.     cn; write ('Press any key...');
  878.     clreol;
  879.     lc:=bioskey;setcurwindow(w1);
  880.   end;
  881.  
  882.   procedure dotime;
  883.   var c,s,l:integer;
  884.       d1,d2,d3,d4:char;
  885.       ap,m:char;
  886.  
  887.     function digit (k:char):boolean;
  888.     begin
  889.       digit:=ord(k) in [48..57]
  890.     end;
  891.  
  892.   begin
  893.     l:=length(inp);
  894.     if l=1 then begin
  895.       if upcase(inp[1])='N' then dostr;
  896.       exit
  897.     end;
  898.     if (l<7) or (l>8) then exit;
  899.     c:=pos(':',inp);
  900.     if c<>l-5 then exit;
  901.     s:=pos(' ',inp);
  902.     if s<>l-2 then exit;
  903.     d2:=inp[c-1];
  904.     if l=7
  905.       then d1:='0'
  906.       else d1:=inp[1];
  907.     d3:=inp[c+1];
  908.     d4:=inp[c+2];
  909.     ap:=upcase(inp[s+1]);
  910.     m:=upcase(inp[s+2]);
  911.     if d1='1' then if d2>'2' then d2:='!';
  912.     if (d1>='0') and (d1<='1') and digit(d2) and (d3>='0') and (d3<='5')
  913.        and digit(d4) and ((ap='A') or (ap='P')) and (m='M') then dostr
  914.   end;
  915.  
  916.   procedure dobaud;
  917.   var inp:lstr;
  918.       n:longint;
  919.       cnt:baudratetype;
  920.   label bfound,again;
  921.   begin   setcurwindow(w2);
  922.     gotoxy (1,2);
  923.     repeat
  924.       gotoxy (1,2);
  925.       write ('Baud rate to toggle [CR to quit]: ');
  926.       clreol;
  927.       buflen:=5;
  928.       readln (inp);
  929.       gotoxy (1,2);
  930.       if length(inp)=0 then begin setcurwindow(w1);exit;end;
  931.       n:=valu(inp);
  932.       for cnt:=b110 to b57600 do if n=baudarray[cnt] then goto bfound;
  933.       cb; write ('Not supported!  '); cn;
  934.       goto again;
  935.       bfound:
  936.       if cnt in p.baudsetptr^
  937.         then p.baudsetptr^:=p.baudsetptr^-[cnt]
  938.         else p.baudsetptr^:=p.baudsetptr^+[cnt];
  939.       setcurwindow(w1);
  940.       reshow; setcurwindow(w2);
  941.       again:
  942.     until 0=1
  943.   end;
  944.  
  945.   procedure dousertime;
  946.   var input:lstr;
  947.       n:integer;
  948.       buffer,buffer2:array [1..10092] of byte;
  949.       b,b2:block;
  950.  
  951.     procedure refresh;
  952.     var cnt:integer;
  953.     begin
  954.       clearwindow (11);
  955.       gotoxy (1,1);
  956.      { cn; } setcolor(11);
  957.       writeln('Level Time | Level Time | Level Time | Level Time | Level Time');
  958.       writeln('-----------|------------|------------|------------|-----------');
  959.       gotoxy (1,3);
  960.       for cnt:=1 to 100 do begin
  961.         write (cnt:4,': ',configset.usertim[cnt]:4);
  962.         if (cnt mod 5)=0 then writeln else write (' | ')
  963.       end
  964.     end;
  965.  
  966.     procedure setone (n,v:integer);
  967.     var x,y:integer;
  968.     begin
  969.       x:=((n-1) mod 5)*13+7;
  970.       y:=((n-1) div 5)+3;
  971.       gotoxy (x,y);
  972.       write (v:4);
  973.       configset.usertim[n]:=v
  974.     end;
  975.  
  976.     procedure getone (n:integer);
  977.     var x,y,v:integer;
  978.     begin
  979.       x:=((n-1) mod 5)*13+7;
  980.       y:=((n-1) div 5)+3;
  981.       gotoxy (x,y);
  982.       write ('    ');
  983.       gotoxy (x,y);
  984.       buflen:=4;
  985.       readln (input);
  986.       v:=valu(input);
  987.       if (v<1) or (v>1000) then v:=configset.usertim[n];
  988.       setone (n,v)
  989.     end;
  990.  
  991.     function getn (txt:lstr):integer;
  992.     var input:lstr;
  993.     begin
  994.       gotoxy (1,23);
  995.       write (txt,': ');
  996.       clreol;
  997.       buflen:=4;
  998.       readln (input);
  999.       getn:=valu(input)
  1000.     end;
  1001.  
  1002.     function getlvl (txt:lstr):integer;
  1003.     var n:integer;
  1004.     begin
  1005.       n:=getn (txt);
  1006.       if (n<1) or (n>100) then n:=0;
  1007.       getlvl:=n
  1008.     end;
  1009.  
  1010.     procedure pattern;
  1011.     var st,en,ba,se,cn:integer;
  1012.     begin
  1013.       st:=getlvl ('Starting level of pattern');
  1014.       if st=0 then exit;
  1015.       en:=getlvl ('Ending level of pattern');
  1016.       if en<st then exit;
  1017.       ba:=getn ('Time for level '+strr(st));
  1018.       if (ba<1) or (ba>1000) then exit;
  1019.       se:=getn ('Additional time per level');
  1020.       if (se<0) or (se>1000) then exit;
  1021.       cn:=st;
  1022.       repeat
  1023.         setone (cn,ba);
  1024.         if ba+se<1000
  1025.           then ba:=ba+se
  1026.           else ba:=1000;
  1027.         cn:=cn+1
  1028.       until cn>en
  1029.     end;
  1030.  
  1031.   var k:char;
  1032.   begin
  1033.     if not highres then begin
  1034.     setblock (b,1,1,80,20);
  1035.     readblock (b,buffer);
  1036.     setblock(b2,1,20,80,25);
  1037.     readblock(b2,buffer2);
  1038.     end else begin
  1039.     setblock (b,1,1,80,37);
  1040.     readblock(b,buffer);
  1041.     setblock(b2,1,37,80,43);
  1042.     readblock(b2,buffer2);
  1043.     end;
  1044.     setcurwindow(w2);
  1045.     closewindow; setcurwindow(w1); closewindow;
  1046.     if highres then textmode(co80);
  1047.     refresh;
  1048.     repeat
  1049.       repeat
  1050.         gotoxy (1,24);
  1051.         write ('Number to change, [P] for a pattern, or [Q] to quit: ');
  1052.          readln (input)
  1053.       until length(input)>0;
  1054.       k:=upcase(input[1]);
  1055.       n:=valu(input);
  1056.       if (n>=1) and (n<=100) then getone(n) else
  1057.         case k of
  1058.           'P':pattern
  1059.         end
  1060.     until k='Q';
  1061.     if highres then textmode(c80+font8x8);
  1062.     if not highres then begin
  1063.     openwindow(w1,1,1,80,20,127,127);
  1064.     openwindow(w2,1,21,80,25,112,127);   end else
  1065.     begin openwindow(w1,1,1,80,37,127,127);
  1066.     openwindow(w2,1,38,80,43,112,127);
  1067.     end;
  1068.     {setcurwindow(w1);} setcurwindow(w1);
  1069.     writeblock (b,buffer);
  1070.     setcurwindow(w2); writeblock(b2,buffer2);
  1071.   end;
  1072.  
  1073.   procedure doattrib;
  1074.  
  1075.  
  1076.     function demo:integer;
  1077.       var cnt:integer;
  1078.           K:char;
  1079.           w3:window;
  1080.     begin
  1081.          openwindow(w3,18,9,50,14,15,15);
  1082.          setcurwindow(w3);
  1083.          gotoxy(5,1);
  1084.          setcolor(15);
  1085.          write('  Color Selection');
  1086.          gotoxy(10,3);
  1087.          for cnt:=0 to 15 do begin
  1088.            setcolor(cnt);
  1089.            write('█');
  1090.            end;
  1091.            cnt:=0;
  1092.            repeat
  1093.             gotoxy(10+cnt,2);
  1094.             setcolor(15);
  1095.             write('');
  1096.             gotoxy(2,3);setcolor(cnt);
  1097.             if cnt=0 then
  1098.             begin
  1099.             setcolor(16*7); write('Black');
  1100.             setcolor(cnt); write('   ');
  1101.             end else
  1102.             write(colorstr[cnt]);
  1103.             k:=bioskey;
  1104.             if (k=#205) or (K=#131) then begin
  1105.                gotoxy(cnt+10,2);write(' ');
  1106.                cnt:=cnt+1;
  1107.                if cnt>15 then cnt:=0;
  1108.                end else if (k=#203) or (k=#130) then begin
  1109.                gotoxy(cnt+10,2);write(' ');
  1110.                cnt:=cnt-1;
  1111.                if cnt<0 then cnt:=15;
  1112.                end;
  1113.             until (k=#13) or (k=#27);
  1114.             if k=#13 then demo:=cnt
  1115.              else demo:=p.i^;
  1116.       closewindow;
  1117.       setcurwindow(w1);
  1118.     end;
  1119.  
  1120.   var cnt,v:integer;
  1121.       k:char;
  1122.   begin
  1123.     v:=demo;
  1124.     p.i^:=v;
  1125.   end;
  1126.  
  1127. begin
  1128.   t:=things[n];
  1129.   pu:=t.p;
  1130.   gotopage (whichpage(n));
  1131.   y:=whichline(n);
  1132.   if not (t.ttype in [tbaudset,tusertime,tattrib,tboolean]) then begin
  1133.     setcurwindow(w2);
  1134.     gotoxy (1,1);
  1135.     clreol;
  1136.     write (t.descrip);
  1137.     clreol;
  1138.     gotoxy (1,3);
  1139.     case t.ttype of
  1140.       tinteger:
  1141.         begin
  1142.           buflen:=6;
  1143.           showintrange
  1144.         end;
  1145.       tsstr,ttime:buflen:=15;
  1146.       tmstr:buflen:=35;
  1147.       tlstr,tpath:buflen:=80;
  1148.       tchar:buflen:=1;
  1149.       tword:begin
  1150.             buflen:=6;
  1151.             showbaudrange;
  1152.       end;
  1153.     end;
  1154.     if buflen+dcol>79 then buflen:=79-dcol;
  1155.     setcurwindow(w1);
  1156.     gotoxy (dcol,y-2);
  1157.     clreol;
  1158.     { if editit then setdefaultinput (varstr(n));}
  1159.     readln (inp)
  1160.   end else inp[0]:=^A;
  1161.   if editit and (t.ttype=tboolean) then inp:='AA';
  1162.   if t.ttype=tpath then dopath;
  1163.   if length(inp)<>0 then
  1164.     case t.ttype of
  1165.       tinteger:doint;
  1166.       tsstr,tmstr,tlstr:dostr;
  1167.       tboolean:doboolean;
  1168.       tchar:dochar;
  1169.       tbaudset:dobaud;
  1170.       ttime:dotime;
  1171.       tattrib:doattrib;
  1172.       tword:doword;
  1173.       tusertime:dousertime
  1174.     end;
  1175.   reshow; setcurwindow(w2);
  1176.   gotoxy (1,2);
  1177.   clreol;
  1178.   writeln;
  1179.   clreol;
  1180.   writeln;
  1181.   clreol;    setcurwindow(w1);
  1182.   t.p:=pu;
  1183.   things[n]:=t
  1184. end;
  1185.  
  1186. procedure changenum (ns:integer; editit:boolean);
  1187. var n:integer;
  1188. begin
  1189.   n:=ns+top-1;
  1190.   if (n<1) or (n>numthings) then exit;
  1191.   setcurwindow(w2);gotoxy(1,1);cn;clreol;write(things[n].descrip);
  1192.   setcurwindow(w1); getinput(n,editit);
  1193. end;
  1194.  
  1195. procedure maybemakeconfig;
  1196. var f:file of configsettype;
  1197.     s,w:integer;
  1198. begin
  1199.   s:=ofs(configset.fille)-ofs(configset.versioncod);
  1200.   w:=sizeof(configsettype);
  1201.   if s>w then begin
  1202.     writeln;
  1203.     writeln ('****** ERROR: CONFIGSETTYPE is too short!');
  1204.     writeln ('              Size of configuration is: ',s);
  1205.     writeln ('                   Bytes being written: ',w);
  1206.     writeln;
  1207.     halt
  1208.   end;
  1209.   assign (f,'Config.bbs');
  1210.   reset (f);
  1211.   if ioresult=0 then begin
  1212.     close (f);
  1213.     exit
  1214.   end;
  1215.   fillchar (configset,sizeof(configset),0);
  1216.   formatconfig
  1217. end;
  1218.  
  1219. var command:sstr;
  1220.     i:integer;
  1221.     ken:char;
  1222. begin
  1223.   highres:=false;
  1224.   if match(paramstr(1),'/ON') then highres:=true;
  1225. { if not highres then begin
  1226.     clrscr;
  1227.     write('Use High Resolution EGA/VGA Mode? [y/N]:');
  1228.     ken:=readkey;
  1229.     if (ken='y') or (ken='Y') then highres:=true;
  1230.   end; }
  1231.   if highres then textmode(c80+font8x8) else textmode (co80);
  1232.   initscrnunit; { openwindow(w1,1,1,80,20,127,112); openwindow(w2,1,21,80,25,112,127);delay(10000);}
  1233.   curwindowptr^.normalcolor:=normalcolor;
  1234.   curwindowptr^.boldcolor:=boldcolor;
  1235.   curwindowptr^.barcolor:=barcolor;
  1236.   curwindowptr^.inputcolor:=inputcolor;
  1237.   curwindowptr^.choicecolor:=choicecolor;
  1238.   curwindowptr^.datacolor:=datacolor;
  1239.   gotoxy (1,1); setcolor(15);
  1240.   writeln ('One moment...');
  1241.   gotoxy(26,10);setcolor(9);
  1242.   write('ViSiON BBS Configuration');
  1243.   gotoxy(25,11);setcolor(10);
  1244.   write('(c) 1991 Ruthless Enterprises');
  1245.   readdata;
  1246.   assignptrs;
  1247.   maybemakeconfig;
  1248.   readconfig;
  1249.   i:=ioresult;
  1250.   numpages:=whichpage(numthings);
  1251.   page:=0;
  1252.   if not highres then begin openwindow(w1,1,1,80,20,127,127);
  1253.   openwindow(w2,1,21,80,25,112,127);
  1254.   end else begin openwindow(w1,1,1,80,37,127,127);
  1255.   openwindow(w2,1,38,80,43,112,127); setcurwindow(w2);
  1256.   gotoxy(17,4);
  1257.   setcolor(boldcolor+3);
  1258.   write('   ViSiON Systems Configuration v'+versionnum);
  1259.   end;
  1260.   gotopage (1);
  1261.   repeat
  1262.     setfilter (configset.checksnowmod);
  1263.     setcurwindow(w2);
  1264.     gotoxy (1,3); setcolor(boldcolor);
  1265.     write ('F1: Edit entry  F10: Save/exit  PgUp: Last page  PgDn: Next page  Esc: Abort');
  1266.     setcurwindow(w1);
  1267.     i:=useprompts(prompt);
  1268.     setcurwindow(w2);gotoxy(1,1);clreol;cn;write(things[i+top-1].descrip);
  1269.     setcurwindow(w1);
  1270.     if bioslook in [#32..#126]
  1271.       then changenum (i,true)
  1272.       else case bioskey of
  1273.         #187:begin          gotoxy (1,1);
  1274.             write (i);
  1275.             changenum (i,true);
  1276.         end;
  1277.         #196:begin
  1278.                writeconfig;
  1279.                byebye
  1280.              end;
  1281.         #27:abortyn;
  1282.         #13:changenum (i,false);
  1283.         #201:gotopage (page-1);
  1284.         #209:gotopage (page+1)
  1285.       end
  1286.   until 0=1
  1287. end.
  1288.  
  1289.  
  1290.